package com.yuexia.sell.converter;

import com.yuexia.sell.dataOjbect.OrderMaster;
import com.yuexia.sell.dto.OrderDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author itmrchen
 * @date 2018/7/12 0012 下午 1:20
 * @desc ctrate by YUE XIA
 */
public class OrderMasterToOrdeDtoConverter {

    public static OrderDTO convert(OrderMaster orderMaster){
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> convert(List<OrderMaster> orderMaster){
        return orderMaster.stream().map(e ->
        convert(e)
        ).collect(Collectors.toList());
    }
}
